-module(ehttp_middle_logger).

-export([
    enter/1
    ,leave/1
]).

-include("ehttpd.hrl").


enter(_Req) ->
    erlang:put(?MODULE, os:timestamp()),
    ok.

leave(#{req := Req}) ->
    Path = cowboy_req:path(Req),
    ?EH_ECHO("访问:~s, 用时(微秒):~w", [Path, ehttp_util:time_diff(erlang:get(?MODULE), os:timestamp())]),
    ok.
